package com.study.io.bio.demo.output;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

/**
 * 字节数组缓存输出流
 *
 * @author wuxj
 */
public class ByteArrayOutputStreamDemo {

    public static void main(String[] args) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        baos.write("123".getBytes());

        //reset之后重写 如果不reset往后增加
        baos.reset();
        baos.write("456".getBytes());
        System.out.println(baos.toString());
    }
}
